package com.bitoon.tienda.jpa;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;

@Entity
@Table(name = "ingreso", schema="central")
@NamedQueries({
    /*
    @NamedQuery(name = "Ingreso.findAll", query = "SELECT i FROM Ingreso i"),
    @NamedQuery(name = "Ingreso.findById", query = "SELECT i FROM Ingreso i WHERE i.id = :id"),
    @NamedQuery(name = "Ingreso.findByFPeticion", query = "SELECT i FROM Ingreso i WHERE i.fPeticion = :fPeticion"),
    @NamedQuery(name = "Ingreso.findByFFin", query = "SELECT i FROM Ingreso i WHERE i.fFin = :fFin"),
    @NamedQuery(name = "Ingreso.findByEstado", query = "SELECT i FROM Ingreso i WHERE i.estado = :estado"),
    @NamedQuery(name = "Ingreso.findByMoneda", query = "SELECT i FROM Ingreso i WHERE i.moneda = :moneda"),
    @NamedQuery(name = "Ingreso.findByImporte", query = "SELECT i FROM Ingreso i WHERE i.importe = :importe"),
    @NamedQuery(name = "Ingreso.findByComision", query = "SELECT i FROM Ingreso i WHERE i.comision = :comision"),
    @NamedQuery(name = "Ingreso.findByPasarelaId", query = "SELECT i FROM Ingreso i WHERE i.pasarelaId = :pasarelaId"),
    @NamedQuery(name = "Ingreso.findByClave", query = "SELECT i FROM Ingreso i WHERE i.clave = :clave"),
    @NamedQuery(name = "Ingreso.findByJuegoId", query = "SELECT i FROM Ingreso i WHERE i.juegoId = :juegoId")
     *
     */
    @NamedQuery(name = "Ingreso.findByUsuarioId", query = "SELECT i FROM Ingreso i WHERE i.usuarioId = :idUsuario and i.estado=0 order by i.fFin DESC")
})

public class Ingreso implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @SequenceGenerator(name="ingreso_id_generator", sequenceName="central.ingreso_id_seq", allocationSize=1)
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="ingreso_id_generator")
    @Basic(optional=false)
    private Integer id;

    @Basic(optional = false)
    @Column(name = "f_peticion")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fPeticion;
    @Basic(optional = true)
    @Column(name = "f_fin")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fFin;
    @Basic(optional = false)
    @Column(name = "estado")
    private short estado;
    @Basic(optional = false)
    @Column(name = "moneda")
    private String moneda;
    @Basic(optional = false)
    @Column(name = "importe")
    private BigDecimal importe;
    @Basic(optional = false)
    @Column(name = "comision")
    private BigDecimal comision;
    @Basic(optional = false)
    @Column(name = "pasarela_id")
    private short pasarelaId;
    @Basic(optional = false)
    @Column(name = "clave")
    private String clave;
    @Basic(optional = false)
    @Column(name = "juego_id")
    private short juegoId;

    @Basic(optional = false)
    @Column(name = "usuario_id")
    private int usuarioId;

    @Basic(optional = false)
    @Column(name = "bitoones")
    private int bitoones;

    public Ingreso() {
    }

    public Ingreso(Integer id) {
        this.id = id;
    }

    public Ingreso(Integer id, Date fPeticion, Date fFin, short estado, String moneda, BigDecimal importe, BigDecimal comision, short pasarelaId, String clave, short juegoId) {
        this.id = id;
        this.fPeticion = fPeticion;
        this.fFin = fFin;
        this.estado = estado;
        this.moneda = moneda;
        this.importe = importe;
        this.comision = comision;
        this.pasarelaId = pasarelaId;
        this.clave = clave;
        this.juegoId = juegoId;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getFPeticion() {
        return fPeticion;
    }

    public void setFPeticion(Date fPeticion) {
        this.fPeticion = fPeticion;
    }

    public Date getFFin() {
        return fFin;
    }

    public void setFFin(Date fFin) {
        this.fFin = fFin;
    }

    public short getEstado() {
        return estado;
    }

    public void setEstado(short estado) {
        this.estado = estado;
    }

    public String getMoneda() {
        return moneda;
    }

    public void setMoneda(String moneda) {
        this.moneda = moneda;
    }

    public BigDecimal getImporte() {
        return importe;
    }

    public void setImporte(BigDecimal importe) {
        this.importe = importe;
    }

    public BigDecimal getComision() {
        return comision;
    }

    public void setComision(BigDecimal comision) {
        this.comision = comision;
    }

    public short getPasarelaId() {
        return pasarelaId;
    }

    public void setPasarelaId(short pasarelaId) {
        this.pasarelaId = pasarelaId;
    }

    public String getClave() {
        return clave;
    }

    public void setClave(String clave) {
        this.clave = clave;
    }

    public short getJuegoId() {
        return juegoId;
    }

    public void setJuegoId(short juegoId) {
        this.juegoId = juegoId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Ingreso)) {
            return false;
        }
        Ingreso other = (Ingreso) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bitoon.tienda.jpa.Ingreso[id=" + id + "]";
    }

    public int getUsuarioId() {
        return usuarioId;
    }

    public void setUsuarioId(int usuarioId) {
        this.usuarioId = usuarioId;
    }

    public int getBitoones() {
        return bitoones;
    }

    public void setBitoones(int bitoones) {
        this.bitoones = bitoones;
    }

}
